﻿@{
    Layout = "~/Views/Shared/OA/_Layout.cshtml";
    ViewBag.Title = "后台管理";
    //CommonAppService.Current.GetSettingValue("Common_Management", "Name");
    //   var user = ManagerAuthorization.Current.User;
}
<link href="~/App_Content/Theme/OA/css/index.css" rel="stylesheet" />


<div class="left-nav">
    @if (ManagerAuthorization.Current.User.Application == "QT")
    {
        @Html.Action("ReadForFirstLevel", "UserTreePower", new { Area = "TS" })
    }
    else
    {
        @Html.Action("ReadForAll", "UserModule", new { Area = "Common", VPartial = "ReadForFirstLevel" })

    }

</div>
<div class="right">
    <div class="content">
        <div class="top">
            <div class="status">
                @ManagerAuthorization.Current.User.Name
                <a onclick="activeTab('Com_User_ChangePassword', '修改密码', '/Common/User/ChangePassword')">修改密码</a>
                <a href="/Common/User/Logout">退出登录</a>
                <a target="_Blank" href="http://get.adobe.com/cn/flashplayer/">Flash安装</a>
                @*<a target="_blank" href="/OA/ClearCache">清除缓存</a>*@
            </div>

            <div class="message">
                后台管理系统
            </div>
        </div>
        <div class="container" id="container">
            <div class="container-left">
                @if (ManagerAuthorization.Current.User.Application == "QT")
                {
                    @Html.Action("ReadForSecondLevel", "UserTreePower", new { Area = "TS" })
                }
                else
                {
                    @Html.Action("ReadForAll", "UserModule", new { Area = "Common", VPartial = "ReadForSecondLevel" })
                }

            </div>
            <div class="container-right">
                <ul class="sub-nav" id="subNav"></ul>
                <div class="iframe" id="iframe">
                </div>
            </div>
        </div>
    </div>
</div>

<script src="~/App_Content/Script/OA/index.js?20141128"></script>

<script>
    $('#container .container-left li a').eq(0).click();
</script>

<script>
    $(function () {

        $('#container .container-left li a').eq(0).click();
    })
</script>


<script>
    jQuery(function () {
        if ($.browser.msie && ($.browser.version == 6.0) && !$.support.style) {
            window.location = "/App_Content/Html/Browser.htm";
        }
        else if ($.browser.msie && ($.browser.version == 7.0) && !$.support.style) {
            window.location = "/App_Content/Html/Browser.htm";
        }
    });
</script>

<script type="text/javascript">
      function getVendorPrefix() {
            const body = document.body || document.documentElement
            const style = body.style
            const vendor = ['webkit', 'khtml', 'moz', 'ms', 'o']
            let i = 0
            while (i < vendor.length) {
                // 此处进行判断是否有对应的内核前缀
                if (typeof style[vendor[i] + 'Transition'] === 'string') {
                    return vendor[i]
                }
                i++
            }
        }

        console.log('getVendorPrefix()',getVendorPrefix());

        if (getVendorPrefix() !== 'webkit') {
            window.location.href = 'https://www.google.cn/chrome/'
            alert('检测到您的浏览器无法正常访问系统，请将浏览器切换到 极速内核/极速模式！(点击地址栏最右侧的浏览器图标切换)，强烈建议使用 谷歌Chrome浏览器 （已为您转至快速下载地址）！')
        }

    var winHeight = $("body").height();
    var container = $("#container");
    var iframe = $("#iframe");
    var arrow = $(".arrow-0");
    var navScroll = $('.nav-scroll');
    navScroll.height(winHeight - 90 + 32);
    container.height(winHeight - 82 + 32);
    iframe.height(winHeight - 116 + 32);
    $(window).resize(function () {
        winHeight = $("body").height();
        container.height(winHeight - 82 + 32);
        iframe.height(winHeight - 116 + 32);
        navScroll.height(winHeight - 90 + 32);
    });

    var twoMenu = $(".container-left");
    var oneMenu = $(".left-nav");
    var threeMenu = $("#subNav");

    twoMenu.delegate('li', 'click', function (e) {
        var key = $(this).attr('key');
        var url = $(this).attr('url');
        var name = $(this).attr('name');

        activeTab(key, name, url);
        return false;
    });

    oneMenu.delegate('li', 'click', function () {
        var index = $(this).attr("data-id");
        if (index) {
            twoMenu.find('ul').hide().eq(index).show();
            //arrow.css('top', (45 + 86 * index) + 'px');
        }
        oneMenu.find('.on').removeClass('on');
        $(this).addClass('on');
        return false;
    });

    threeMenu.delegate('li', 'click', function () {
        var key = $(this).attr('key');
        var url = $(this).attr('url');
        var name = $(this).attr('name');
        activeTab(key, name, url);
        return false;
    }).delegate('li .delete', 'click', function () {
        removeFrame($(this).parent().attr('key'));
        $(this).parent().remove();
        var last = threeMenu.find("li:last-child");
        if (last.length > 0) {
            activeTab(last.attr('key'), last.attr('name'), last.attr('url'));
        } else {
            twoMenu.find('a').removeClass('active');
        }
        return false;
    });

    $('body').on('click', function (e) {
        var ac = e.target.getAttribute('data-action');
        if (ac === "changePassword") {
            activeTab("Common_User_ChangePassword", "修改密码", e.target.getAttribute('data-url'));
            return false;
        }
    });
</script>
